<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">

    <meta name="viewport" content="width=device-width"/>
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">

    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="/img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <!-- JavaScript files-->
    <script src="/vendor/jquery/jquery.min.js"></script>
    <script src="/vendor/popper.js/umd/popper.min.js"></script>
    <script src="/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="/vendor/jquery.cookie/jquery.cookie.js"></script>
    <script src="/vendor/chart.js/Chart.min.js"></script>
    <script src="/vendor/jquery-validation/jquery.validate.min.js"></script>
    <!-- Main File-->
    <script src="/js/front.js"></script>
    <script type="text/javascript">
        function toSaveFeed() {
            var mypositioningPhoneNumber = $.trim($("#mypositioningPhoneNumber").val());
            var feedbackInfo = $.trim($("#feedbackInfo").val());
            console.log('mypositioningPhoneNumber:' + mypositioningPhoneNumber + 'feedbackInfo:' + feedbackInfo);

            if (mypositioningPhoneNumber == "") {
                alert("手机号码不能为空");
                return false;
            }
            if (mypositioningPhoneNumber.length != 11) {
                alert("手机号码长度必须为11位");
                return false;
            }


            if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(mypositioningPhoneNumber))){
                alert("手机号码格式不对，请重填");
                return false;
            }


            if(feedbackInfo==""){
                alert("反馈意见不能为空");
                return false;
            }

            if (feedbackInfo.length >300) {
                alert("反馈意见长度不能多于300");
                return false;
            }

            $.ajax({
                type: "POST",
                url: "/userManagement/addFeedback",
                data: {"mypositioningPhoneNumber": mypositioningPhoneNumber, "feedbackInfo": feedbackInfo},
                cache: false,
                async: false,
                dataType: "json",
                complete: function (ret) {
                    var jsonVar = eval(JSON.parse(ret.responseText));
                    //debugger;
                    if (jsonVar.status == 1 && jsonVar.code == "0000") {
                        alert(jsonVar.message);
                        setTimeout(window.location.href = '/userManagement/settingIndex', 1);
                    } else if ("登录超时请重新登录" == jsonVar.message) {
                        alert(jsonVar.message);
                        setTimeout(window.location.href = '/userManagement/loginIndex', 1);
                    } else {
                        alert(jsonVar.message);
                    }
                }, error: function (retMsg) {
                    alert("保存出错...");
                }
            });
        }
    </script>
</head>
<body>
<div class="page">
    <div class="page-content d-flex align-items-stretch">
        <div class="content-inner">
            <div class="breadcrumb-holder container-fluid">
                <ul class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/userManagement/settingIndex">设置</a></li>
                </ul>
            </div>
            <!-- Forms Section-->
            <section class="forms">
                <div class="container-fluid">
                    <div class="row">
                        <!-- Form Elements -->
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">
                                    <form class="form-horizontal">
                                        <div class="form-group row">
                                            <div class="col-sm-9">
                                                <input type="text" id="mypositioningPhoneNumber"
                                                       name="mypositioningPhoneNumber"
                                                       placeholder="联系方式" maxlength="11"
                                                       onkeyup="value=value.replace(/[^0-9a-zA-Z]/g,'')"
                                                       class="form-control">
                                            </div>
                                        </div>
                                        <div class="line"></div>
                                        <div class="form-group row">
                                            <div class="col-sm-9">
                                                <textarea id="feedbackInfo" maxlength="300"
                                                       name="feedbackInfo"
                                                       placeholder="反馈意见(300字以内)" class="form-control" cols="50" rows="7"></textarea>
                                            </div>
                                        </div>

                                        <div class="line"></div>

                                        <div class="form-group row">
                                            <div class="col-sm-9 offset-sm-3">
                                                <input type="button" value="提交意见"
                                                       onclick="toSaveFeed();"
                                                       class="btn btn-primary">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </section>
        </div>
    </div>
</div>

</body>
</html>